!
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
    <div id='app'>
       
            <input type="text" v-model:value="num1">
            +<input type="text" v-model:value="num2">
            =
            <input type="text" v-model:value="num">
      
    </div>
    <!-- <template id="demo">

    </template> -->
    <script>
        // Vue.component("mylogin", {
        //     template: "#demo",
        //     data() {
        //         return {
        //             num1: "",
        //             num2: "",
        //             num: "",
        //         }
        //     },

        // methods:{
        //     but(){
        //         this.num=Number(this.num1)+Number(this.num2)
        //     }
        // }

        // })
        const vm = new Vue({
            el: '#app',
            data: {
                num1: "",
                num2: "",
                num: ""
            },
            // watch: {
            //     "num1": (newValue, oldvalue) => {
            //         console.log(newValue);
            //         this.num = Number(this.num1) + Number(this.num2)
            //     },
            //     "num2": (newValue, oldvalue) => {
            //         console.log(newValue);
            //         this.num = Number(this.num1) + Number(this.num2)
            //     },
            // }
            watch: {
                "num1": function(newValue,oldvalue){
                    console.log(newValue);
                    this.num = Number(this.num1) + Number(this.num2)
                }
                    
                ,
                "num2": function(newValue,oldvalue){
                    console.log(newValue);
                    this.num = Number(this.num1) + Number(this.num2)
                }

            }

        })
    </script>
</body>

</html>